/* Copyright (c) 2025 Beijing Semidrive Technology Corporation
 * SPDX-License-Identifier: Apache-2.0
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/** *****************************************************************************************************
 * \file     Fls_Cfg.c                                                                                 *
 * \brief    AUTOSAR 4.3.1 MCAL fls Driver                                                             *
 *           Fls configuration source file                                                             *
 *                                                                                                     *
 * <table>                                                                                             *
 * <tr><th>Date           <th>Version                                                                  *
 * <tr><td>2025-03-25 19:03:22     <td>1.0.0                                                               *
 * </table>                                                                                             *
 *******************************************************************************************************/

#ifdef __cplusplus
extern "C" {
#endif  /* #ifdef __cplusplus */

#include "Fls.h"
/* PRQA S 1533,1552 EOF */
extern uint32 TC_Fls_xspi1aGetClkRate(uint8 id);
extern sint32 TC_Fls_xspi1aSetClkRate(uint8 id, uint32 rate);

#define FLS_START_SEC_VAR_NO_INIT_UNSPECIFIED
#include "Fls_MemMap.h"

static Fls_JobInfoType Fls_PendingJobs[1];

static Fls_ContextType cor0Context;

#define FLS_STOP_SEC_VAR_NO_INIT_UNSPECIFIED
#include "Fls_MemMap.h"

#define FLS_START_SEC_CONST_UNSPECIFIED
#include "Fls_MemMap.h"

static const Fls_SectorConfigType Fls_SectorList[1] =
{
    {
        .numberOfSectors  = 256,
        .pageSize        = 256,
        .sectorSize      = 4096,
        .sectorStartAddr = 0,
        .totalSize       = 1048576,
        .jobNotification = NULL_PTR,
        .jobInfo = &Fls_PendingJobs[0],
        .jobPriority = 0U,
    }
};


static const Fls_ProgramDescriptorType Fls_FlashProgDescriptor = {
    .jobEndNotification = NULL_PTR,
    .jobErrorNotification = NULL_PTR,
};

const Fls_ConfigType  Fls_ConfigData =
{
    .controllerNumber = 1,
    .controllerTable = {
        {
            .id = FLS_XSPI1_PORTA,
            .hostConfig = {
                .config = {
                    .id = (uint8)FLS_XSPI1_PORTA,
                    .apbBase = APB_XSPI1A_BASE,
                    .directBase = XSPI1_XSPI1PORTA_BASE,
                    .refClkHz = 300000000,
                    .fifoSize = 192U,
                    .devType = XSPI_IP_NORFLASH,
                    .semagLockEnable = FALSE,
                    .semagId = 0,
                    .useRomConfig = FALSE,
                    .getClkRate = TC_Fls_xspi1aGetClkRate,
                    .setClkRate = TC_Fls_xspi1aSetClkRate,
                },
                .prefetchEnable = TRUE,
                .rfdEnable = FALSE,
                .useDummyRead = FALSE,
            },
            .busConfig = {
                .csNum = 1u,
                .swResetEn = FALSE,
                .xipEnable = FALSE,
            },
            .pointerContex = &cor0Context,
        }
    /* PRQA S 0686 1 */
    },
    .flashConfig = {
        .callCycle = 100000,  /* in us */
        .defaultMode= MEMIF_MODE_SLOW,
        .maxReadFastMode = 256,
        .maxReadNormalMode = 4096,
        .maxWriteFastMode = 256,
        .maxWriteNormalMode = 4096,
        .sectorListSize = 1U,
        .sectorList = Fls_SectorList,
        .progDesc = &Fls_FlashProgDescriptor,
    },
};
#define FLS_STOP_SEC_CONST_UNSPECIFIED
#include "Fls_MemMap.h"

#ifdef __cplusplus
}
#endif  /* #ifdef __cplusplus */

/* End of file */
